<%--
  Created by IntelliJ IDEA.
  User: 4S
  Date: 2021/11/2
  Time: 19:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<p>添加教育经历</p>
<table>
    <tr>
        <td colspan="2">
            <div class="layui-inline">
                <label class="layui-form-label"> 学&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp校</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="schoolName" placeholder="请填写学校"
                           value="" style="width: 490px">
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <div class="layui-form-item">
                <label class="layui-form-label">学&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp历</label>
                <div class="layui-input-block">
                    <select name="resIdentity" lay-verify="required" id="degree">
                        <option value="大专">大专</option>
                        <option value="本科" selected>本科</option>
                        <option value="硕士">硕士</option>
                        <option value="博士">博士</option>
                        <option value="其他">其他</option>
                    </select>
                </div>
            </div>
        </td>
        <td>
            <div class="layui-inline">
                <label class="layui-form-label">专&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp业</label>
                <div class="layui-input-inline">
                    <input type="text" id="major" class="layui-input" placeholder="请填写专业"
                           value="">
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">在校时间</label>
                    <div class="layui-inline" id="test-range">
                        <div class="layui-input-inline">
                            <input type="text" id="startDate" class="layui-input" placeholder="开始时间"
                                   style="width: 213.4px">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" id="endDate" class="layui-input" placeholder="结束时间"
                                   style="width: 213.4px">
                        </div>
                    </div>
                </div>
            </div>
        </td>
        <td></td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">在校经历</label>
                <div class="layui-input-block">
                    <textarea name="desc" id="experienceSchool" placeholder="请输入内容"
                              class="layui-textarea"></textarea>
                </div>
            </div>
        </td>
    </tr>
</table>
<button class="button_save" onclick="edu_save()">保存并更新</button>
<button class="button_cancel" id="button_edu_cancel">取消</button>
</body>
</html>
<script>
    function edu_save() {
        let resumeId = $("#resumeId").val();
        console.log("resumeId:"+resumeId)
        //学校名称
        let schoolName = $("#schoolName").val();
        console.log(schoolName);
        //学历
        let degree = $("#degree option:selected").val();
        console.log(degree);
        //专业
        let major = $("#major").val();
        console.log(major);
        //在校时间 - 开始
        let startDate = $("#startDate").val();
        console.log(startDate);
        //在校时间 -结束
        let endDate = $("#endDate").val();
        console.log(endDate);
        //在校经历
        let experienceSchool = $("#experienceSchool").val();
        console.log(experienceSchool);
        let param = "schoolName=" + schoolName + "&resumeId=" + resumeId
            + "&degree=" + degree + "&major=" + major + "&startDate=" + startDate + "&endDate=" + endDate + "&experienceSchool=" + experienceSchool;
        console.log(param);
        $.post('/hire/resume/education/insert', param, function (res) {
            if (res.code == '200') {
                $("#edu_info").load("/hire/resume/edu_info", {id: resumeId});
                $("#edu_edit").hide();
                $("#edu_info").show();
            } else {
                layer.msg(res.msg);
            }
        })
    }
    $("#button_edu_cancel").click(function () {
        let resumeId = $("#resumeId").val();
        $("#edu_info").load("/hire/resume/edu_info", {id: resumeId});
        $("#edu_edit").hide();
        $("#edu_info").show();
    })
    layui.use('laydate', function () {
        let laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startDate',
        });
    });
    layui.use('laydate', function () {
        let laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

</script>